// __dirname 表示当前文件所处目录
const path = require('path');
const path1 = path.join('/a','/b/c','../','/d');
console.log(path1);

const path2 = path.join(__dirname, './files/1.txt');
console.log(path2);

const path3 = path.basename( path.join(__dirname, './files/1.txt'));
console.log(path3);

const path4 = path.basename( path.join(__dirname, './files/1.txt'),'.txt'); //清除扩展名
console.log(path4);

const path5 = path.extname(path.join(__dirname, './files/1.txt')); //获得扩展名
console.log(path5);